import { data } from '../services/homePage';

export default {
  namespace: 'homePage',

  state: {
    data: null,
  },

  effects: {
    *data({ payload }, { call, put }) {
      const response = yield call(data, payload);
      yield put({ type: 'callbackData', response });
    },
  },

  reducers: {
    callbackData(st, { response }) {
      const state = st;
      if (response) state.data = response.data;
      return { ...state };
    },
  },
};
